package com.brillilab.starter.controller.elsearch;

import com.brillilab.domain.pa.kit.ReagentSearchPa;
import com.brillilab.domain.po.elsearch.EsReagent;
import com.brillilab.service.core.elsearch.IEsReagentService;
import com.brillilab.starter.aspect.AspectLog;
import com.brillilab.starter.entity.req.elsearch.ReagentBatchSevePa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/es/reagent")
public class EsReagentController {

    @Autowired
    private IEsReagentService esService;


    @RequestMapping(value = "/info", method = RequestMethod.GET)
    public EsReagent queryById(@RequestParam Long reagentId) {
		return esService.queryById(reagentId);
    }
    
    @AspectLog
    @RequestMapping(value = "/seve", method = RequestMethod.POST)
    public EsReagent seve(@RequestBody EsReagent eb) {
    	return esService.save(eb);
    }
    @RequestMapping(value = "/batchSeve", method = RequestMethod.POST)
    public String batchSeve(@RequestBody ReagentBatchSevePa pa) {
    	esService.batchSave(pa.getReagentList());
    	return "OK";
    }

    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public Page<EsReagent> queryList(@RequestBody ReagentSearchPa pa) {
    	return esService.queryList(pa);
    }


}
